home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Codigo / Introducción a Windows Forms / PaintHello / PaintHello.cs next >
Encoding:
Text File  |  2002-05-02  |  750 b   |  26 lines

  1. //-----------------------------------------
  2. // PaintHello.cs ⌐ 2001 by Charles Petzold
  3. //-----------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Windows.Forms;
  7.  
  8. class PaintHello
  9. {
  10.      public static void Main()
  11.      {
  12.           Form form      = new Form();
  13.           form.Text      = "Hola Paint";
  14.           form.BackColor = Color.White;
  15.           form.Paint    += new PaintEventHandler(MyPaintHandler);
  16.  
  17.           Application.Run(form);
  18.      }
  19.      static void MyPaintHandler(object objSender, PaintEventArgs pea)
  20.      {
  21.           Form     form = (Form)objSender;
  22.           Graphics grfx = pea.Graphics;
  23.  
  24.           grfx.DrawString("íHola, mundo!", form.Font, Brushes.Black, 0, 0);
  25.      }
  26. }